<template>
  <div >
    <!-- 基本信息 -->
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">合同信息</span>
    </div>
    <el-table :data="fromdata.contractMap.contractInfo" border style="width: 100%">
      <el-table-column prop="contract_NO" label="合同编号" width="120"/>
      <el-table-column prop="contractType" label="合同类型" width="120"/>
      <el-table-column prop="contract_NAME" label="合同名称" width="180"/>
      <el-table-column prop="amount_INCLUDING_TAX" label="合同金额（元）" width="120"/>
      <el-table-column prop="signed_DATE" label="合同生效时间" width="120"/>
      <el-table-column prop="start_DATE" label="履行开始时间" width="120"/>
      <el-table-column prop="end_DATE" label="履行结束时间" width="120"/>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">项目进度</span>
    </div>
    <el-table :data="fromdata.contractMap.projectProcessList" border style="width: 100%">
      <el-table-column prop="milestoneNode" label="里程碑节点" width="120"/>
      <el-table-column prop="planEndDate" label="计划完成时间" width="180"/>
      <el-table-column prop="actualDeliverer" label="完成人姓名" width="90"/>
      <el-table-column prop="actualDeliveryTime" label="完成时间" width="120"/>
      <el-table-column prop="postponeStatus" label="逾期状态" width="120"/>
      <el-table-column prop="postponeCause" label="逾期原因" width="360"/>
      <el-table-column prop="processProveFile" label="进度证明材料" width="200">
        <template slot-scope="scope">
          <div v-if="scope.row.processProveFile" v-for="(fileitem) in scope.row.processProveFile" :key="fileitem.id" style="margin-left:20px">
            <div readonly class="font14 fileLink" style="color:#0F85CF">
              <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{fileitem.fileName}}</a>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">应收信息
    </span>
    </div>
    <el-table :data="fromdata.contractMap.contractPayeeList" border style="width: 100%">
      <el-table-column prop="contractSerialNumber" label="合同流水号" width="120"/>
      <el-table-column prop="contractType" label="合同类型" width="180"/>
      <el-table-column prop="contractAmount" label="合同金额(元)" width="120"/>
      <el-table-column prop="fee_it" label="IT费(元)" width="120"/>
      <el-table-column prop="fee_ct" label="CT费(元)" width="120"/>
      <el-table-column prop="payableProportion" label="应收比(%)" width="120"/>
      <el-table-column prop="adjustPayableProportion" label="应收比调整后(%)" width="130"/>
      <el-table-column prop="nowPayAmount" label="应收(元)" width="120"/>
      <el-table-column prop="fee_ct_proportion" label="IT费比(%)" width="120"/>
      <el-table-column prop="now_pay_it" label="IT应收(元)" width="120"/>
      <el-table-column prop="nowPayItCity" label="IT应收(元,市核定)" width="90"/>
      <el-table-column prop="nowPayItProvince" label="IT应收(元,省核定)" width="90"/>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">已出账账单
    </span>
    </div>
    <el-table :data="fromdata.contractMap.bossBillInfoList" border style="width: 100%">
      <el-table-column prop="key_num" label="计费号码" width="120"/>
      <el-table-column prop="acct_id" label="账户ID" width="180"/>
      <el-table-column prop="product_instance_id" label="用户ID" width="120"/>
      <el-table-column prop="billing_cycle_id" label="账期" width="120"/>
      <el-table-column prop="acct_item_type_id" label="账单科目" width="120"/>
      <el-table-column prop="acct_item_type_name" label="账单名称" width="120"/>
      <el-table-column prop="rece_amount" label="应收费用(元)" width="120"/>
      <el-table-column prop="real_amount" label="实收费用(元)" width="120"/>
      <el-table-column prop="billArrears" label="账单欠费(元)" width="120"/>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">缴费信息
    </span>
    </div>
    <el-table :data="fromdata.contractMap.bossPayInfoList" border style="width: 100%">
      <el-table-column prop="serv_number" label="计费号码" width="120"/>
      <el-table-column prop="fb_area_code" label="地市编码" width="120"/>
      <el-table-column prop="payrec_fee" label="缴费金额(元)" width="120"/>
      <el-table-column prop="foreign_date" label="缴费时间" width="120"/>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">项目效益评估</span>
    </div>
    <el-table :data="fromdata.contractMap.benefiteValuationList" border style="width: 100%">
      <el-table-column prop="benefiteValuationType" label="效益评估阶段" width="120"/>
      <el-table-column prop="overallNrm" label="整体利润率" width="120"/>
      <el-table-column prop="itPrm" label="IT毛利率" width="120"/>
      <el-table-column prop="createdTime" label="评估结果计算日期" width="120"/>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">收入拆分信息（IT部分）</span>
    </div>
    <el-table :data="itList" border style="width: 100%">
      <el-table-column prop="feeItemsName" label="价款费项名称"/>
      <el-table-column prop="feeItemsAmount" label="费项金额合计(含税,元)"/>
      <el-table-column prop="splitBusinessType" label="业务大类" />
      <el-table-column prop="splitSujectName" label="账单名称" />
      <el-table-column prop="splitSujectCode" label="账单代码" />
      <el-table-column prop="coaName" label="COA科目名称" />
      <el-table-column prop="coaCode" label="COA科目代码" />
      <el-table-column prop="maProductName" label="管会产品名称" />
      <el-table-column prop="maProductCode" label="管会产品编码" />
      <el-table-column prop="isUniversal" label="是否属于通服收入" />
      <el-table-column prop="splitTaxRate" label="税率" />
      <el-table-column prop="splitIncludedAmount" label="含税总金额（元）" width="120"/>
      <el-table-column prop="splitNoAmount" label="不含税金额（元）" width="120"/>
      <el-table-column prop="splitTaxAmount" label="税额" />
      <el-table-column prop="paymentType" label="出账类型" />
      <el-table-column prop="billingTime" label="计费时长(月)" />
      <el-table-column prop="splitStartDate" label="预计计费起始日期" />
      <el-table-column prop="splitEndDate" label="预计计费结束日期" />
      <el-table-column prop="contractPhase" label="合同约定计费阶段" />
      <el-table-column prop="contractPaymentStage" label="合同约定收款阶段" />
      <el-table-column prop="isAbilityLogo" label="是否融自有能力" />
      <el-table-column prop="abilityLogo" label="自有能力名称" />
      <el-table-column prop="analysisPushTime" label="合同交底时间" />
      <el-table-column prop="esopBillId" label="计费号" />
      <el-table-column prop="accountName" label="计费科目名称" />
      <el-table-column prop="taxPrice" label="计费科目金额(含税,元)" />
      <el-table-column prop="validDate" label="计费开始时间" />
      <el-table-column prop="expireDate" label="计费结束时间" />
      <el-table-column prop="entrustedSalesAccount" label="是否受托代销科目" />
      <el-table-column prop="relatedBusinessType" label="关联支出业务大类" />
      <el-table-column prop="relatedSubjectCode" label="关联支出科目" />
      <el-table-column prop="relatedSubjectName" label="关联支出科目名称" />
      <el-table-column prop="relatedType" label="关联类型" />
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">收入拆分信息（CT部分）</span>
    </div>
    <el-table :data="ctList" border style="width: 100%">
      <el-table-column prop="feeItemsName" label="价款费项名称"/>
      <el-table-column prop="feeItemsAmount" label="费项金额合计(含税,元)"/>
      <el-table-column prop="splitBusinessType" label="业务大类" />
      <el-table-column prop="splitSujectName" label="账单名称" />
      <el-table-column prop="splitSujectCode" label="账单代码" />
      <el-table-column prop="coaName" label="COA科目名称" />
      <el-table-column prop="coaCode" label="COA科目代码" />
      <el-table-column prop="maProductName" label="管会产品名称" />
      <el-table-column prop="maProductCode" label="管会产品编码" />
      <el-table-column prop="isUniversal" label="是否属于通服收入" />
      <el-table-column prop="splitTaxRate" label="税率" />
      <el-table-column prop="splitIncludedAmount" label="含税总金额（元）" width="120"/>
      <el-table-column prop="splitNoAmount" label="不含税金额（元）" width="120"/>
      <el-table-column prop="splitTaxAmount" label="税额" />
      <el-table-column prop="paymentType" label="出账类型" />
      <el-table-column prop="billingTime" label="计费时长(月)" />
      <el-table-column prop="splitStartDate" label="预计计费起始日期" />
      <el-table-column prop="splitEndDate" label="预计计费结束日期" />
      <el-table-column prop="contractPhase" label="合同约定计费阶段" />
      <el-table-column prop="contractPaymentStage" label="合同约定收款阶段" />
      <el-table-column prop="isAbilityLogo" label="是否融自有能力" />
      <el-table-column prop="abilityLogo" label="自有能力名称" />
      <el-table-column prop="entrustedSalesAccount" label="是否受托代销科目" />
      <el-table-column prop="relatedBusinessType" label="关联支出业务大类" />
      <el-table-column prop="relatedSubjectCode" label="关联支出科目" />
      <el-table-column prop="relatedSubjectName" label="关联支出科目名称" />
      <el-table-column prop="relatedType" label="关联类型" />
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">申报激励信息</span>
    </div>
    <van-field readonly required name="contractValidSignedAmount" :value="fromdata.contractValidSignedAmount" label="合同有效签约金额(万元)：" label-width="12em" />
    <van-field readonly required name="overallGrossMargin" :value="fromdata.overallGrossMargin" label="整体毛利率(去除销售,万元)：" label-width="13em" />
    <van-field readonly required name="cloudNetOwnProductAmount" :value="fromdata.cloudNetOwnProductAmount" label="云网及自有能力产品金额(万元)：" label-width="15em" />
    <van-field readonly required name="cloudNetOwnProductRatio" :value="fromdata.cloudNetOwnProductRatio" label="云网及自有能力产品占比(%)：" label-width="14em" />
    <van-field readonly required name="grossMarginCoefficient" :value="fromdata.grossMarginCoefficient" label="毛利率系数：" label-width="6em" />
    <van-field readonly required name="ownProductCoefficient" :value="fromdata.ownProductCoefficient" label="自有能力系数：" label-width="7em" />
    <van-field readonly required name="cumulativePaymentRatio" :value="fromdata.cumulativePaymentRatio" label="累计回款比例(%)：" label-width="9.75em" />
    <van-field readonly required name="applyRewardStage" :value="fromdata.applyRewardStage" label="申请奖励阶段：" label-width="7em" />
    <van-field readonly required name="totalRewardAmount" :value="fromdata.totalRewardAmount" label="总计奖励金额(万元)：" label-width="11em" />
    <van-field readonly required name="rewarded" :value="fromdata.rewarded" label="是否已奖励：" label-width="6em" />
    <van-field readonly name="actualRewardAmount" :value="fromdata.actualRewardAmount" label="已兑现奖励金额(万元)：" label-width="12em" />
    <van-field readonly required name="actualPaymentRatio" :value="fromdata.actualPaymentRatio" label="已兑现的回款比例(%)：" label-width="11.75em" />
    <van-field readonly required name="currentApplyRewardRatio" :value="fromdata.currentApplyRewardRatio" label="本次申请奖励比例：" label-width="9em" />
    <van-field readonly required name="currentApplyRewardAmount" :value="fromdata.currentApplyRewardAmount" label="本次申请奖励金额(万元)：" label-width="12em" />
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">激励人员信息</span>
    </div>
    <el-table :data="fromdata.rewardReviewNewUserList" border style="width: 100%">
      <el-table-column prop="trueName" label="姓名" width="120"/>
      <el-table-column prop="userName" label="OA账户" width="120"/>
      <el-table-column prop="department" label="部门" width="180"/>
      <el-table-column prop="position" label="职位" width="120"/>
      <el-table-column prop="employeeNumber" label="员工编号" width="120"/>
      <el-table-column prop="employmentType" label="用工性质" width="120"/>
      <el-table-column prop="role" label="角色" width="120"/>
      <el-table-column prop="bonusRatio" label="奖金分配比例（%）" width="120"/>
      <el-table-column prop="individualRewardAmount" label="本次个人奖励分配金额（万元）" width="120"/>
      <el-table-column prop="projectStage" label="参与项目阶段" width="120"/>
      <el-table-column prop="mainWork" label="承担主要工作" width="120"/>
      <el-table-column prop="isProvinceOrCityMgmt" label="是否省公司人员/地市管理层" width="120"/>
      <el-table-column prop="isSalesTeam" label="是否本项目售中团队人员" width="120"/>
    </el-table>
    <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
      <div class="blue_item" />
      <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">申报资料信息</span>
    </div>
    <van-field readonly required label-width="12em" label="收入合同扫描件：" />
    <div v-for="(fileitem) in fromdata.incomeFiles" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <van-field readonly required label-width="12em" label="支出合同扫描件：" />
    <div v-for="(fileitem) in fromdata.outcomeFiles" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <van-field readonly required label-width="12em" label="效益评估表：" />
    <div v-for="(fileitem) in fromdata.benefitEvaluationFileList" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <van-field readonly required label-width="12em" label="到账截图：" />
    <div v-for="(fileitem) in fromdata.accountScreensFile" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <van-field readonly required label-width="12em" label="销账截图：" />
    <div v-for="(fileitem) in fromdata.writeOffScreensFile" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <van-field readonly required label-width="12em" label="情况说明补充文件：" />
    <div v-for="(fileitem) in fromdata.additionalStatementFile" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <van-field readonly required label-width="12em" label="其他补充资料：" />
    <div v-for="(fileitem) in fromdata.otherFile" :key="fileitem.id" style="margin-left:20px">
      <div readonly class="font14 fileLink" style="color:#0F85CF">
        <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
      </div>
    </div>
    <div style="padding-bottom: 42px"></div>
  </div>
</template>
<script>
import { mapGetters } from "vuex"
import SectionHeader from "@/views/sztdzj/sztdzjDetail/section-header.vue";
import dict_type_value from '@/components/dict_type_value';
import myvan_field from "@/components/myvanfield/index.vue";
import {openFileUrl} from "@/store/openFile";

export default {
  components: {
    myvan_field, SectionHeader,
    dict_type_value},
  data() {
    return {
      incomeDataList:{},
      itList:[],
      ctList:[],
    }
  },
  computed: {
    ...mapGetters(['user']),
  },
  props: ['businessdata','fromdata','showHistory','historydata','approveList'],
  created() {
    this.incomeDataList=this.fromdata.contractMap.incomeModelList
    console.log('111111',this.incomeDataList)
    this.setdata()
  },
  methods: {
    setdata(){
      var itList_number1=0
      var itList_number2=0
      var itList_number3=0
      var ctList_number1=0
      var ctList_number2=0
      var ctList_number3=0
      var ctAndIt_number1=0
      var ctAndIt_number2=0
      var ctAndIt_number3=0
      for (var i=0;i<this.incomeDataList.length;i++) {
        if(this.incomeDataList[i].contractPartType=='IT'){
          itList_number1=Number(itList_number1)+Number(this.incomeDataList[i].splitIncludedAmount)
          itList_number2=Number(itList_number2)+Number(this.incomeDataList[i].splitNoAmount)
          itList_number3=Number(itList_number3)+Number(this.incomeDataList[i].splitTaxAmount)
          if(this.incomeDataList[i].isUniversal == "是"){
            this.itUniversalNoAmount = Number(this.incomeDataList[i].splitNoAmount)+ this.itUniversalNoAmount;
          }
          this.itList.push(this.incomeDataList[i]);
        }else{
          ctList_number1=Number(ctList_number1)+Number(this.incomeDataList[i].splitIncludedAmount)
          ctList_number2=Number(ctList_number2)+Number(this.incomeDataList[i].splitNoAmount)
          ctList_number3=Number(ctList_number3)+Number(this.incomeDataList[i].splitTaxAmount)
          this.ctList.push(this.incomeDataList[i]);
        }
        ctAndIt_number1=Number(ctAndIt_number1)+Number(this.incomeDataList[i].splitIncludedAmount)
        ctAndIt_number2=Number(ctAndIt_number2)+Number(this.incomeDataList[i].splitNoAmount)
        ctAndIt_number3=Number(ctAndIt_number3)+Number(this.incomeDataList[i].splitTaxAmount)
      }
      var ctAndItListadd={'feeItemsName':'IT+CT合计','splitIncludedAmount':ctAndIt_number1.toFixed(2), 'splitNoAmount':ctAndIt_number2.toFixed(2), 'splitTaxAmount':ctAndIt_number3.toFixed(2)}
      var itListadd={'feeItemsName':'合计','splitIncludedAmount':itList_number1.toFixed(2), 'splitNoAmount':itList_number2.toFixed(2), 'splitTaxAmount':itList_number3.toFixed(2)}
      this.itList.push(itListadd);
      var ctListadd={'feeItemsName':'合计','splitIncludedAmount':ctList_number1.toFixed(2), 'splitNoAmount':ctList_number2.toFixed(2), 'splitTaxAmount':ctList_number3.toFixed(2)}
      this.ctList.push(ctListadd);
      this.ctList.push(ctAndItListadd);
    },
    openFileUrlfun(value) {
      this.$router.push(
          {
            name: 'fileview',
            query: {
              openFileUrl: openFileUrl(value)
            }
          }
      );
    }
  },
}
</script>

<style>
.tables.el-table .cell {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-all;
  line-height: 15px;
  padding-left: 5px;
  padding-right: 5px;
}
</style>